<?php
class OracledmpsController extends AppController {

	var $name = 'Oracledmps';

	function beforeRender() {
		$groupid = $this->Auth->user('group_id');
		$name = 'Oracledmps';
		IF($groupid != 1){
			$result1 = mysql_query("SELECT id FROM applications WHERE name = '$name'");
			$appid = mysql_fetch_object($result1)->id;
			$result2 = mysql_query("SELECT count(*) as count FROM groupshasrights WHERE group_id = '$groupid' AND application_id = '$appid'");
			$count = mysql_fetch_object($result2)->count;
			IF($count == 0){
				$this->Session->setFlash(__('Access Denied', true));
				$this->redirect(array('controller' => 'pages' ,'action' => 'error'));	
			}
		}
	}
	
	
	function getModemStatus($mac){
		$sql = "SELECT TPI.X_PART_STATUS PARTSTATUS FROM CLY.X_INVENT_ATTR TXI, CLY.PART_INST TPI WHERE TPI.OBJID = TXI.X_INVENT_ATTR2PART_INST AND TXI.X_ID = '$mac'";
	    $result = $this->Oracledmp->query($sql);
	    return $result['0']['TPI']['partstatus'];
	}
	
}
?>